/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package caintra.Sapra.Acceso;

import caintra.Sapra.Internacional.DBManager;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Luis Guerrero
 */
public class Validar extends HttpServlet {

    public DBManager db;
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        try {

        }catch(Exception e){


        }
    } 


    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        String user="";
        String pass="";
        db=new DBManager();
        try {
            user=(String)request.getParameter("user");
            pass=(String)request.getParameter("pwd");
            if((user == null || user.trim().equals("") )||( pass == null || pass.trim().equals("") )){
                response.sendRedirect("Login.jsp&id_msj=1");
            }
        }catch(Exception e){
                response.sendRedirect("Login.jsp&id_msj=1");
        }
    } 

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        String user="";
        String pass="";
        db=new DBManager();
        try {
            user=(String)request.getParameter("user");
            pass=(String)request.getParameter("pwd");
            if((user == null || user.trim().equals("") )||( pass == null || pass.trim().equals("") )){
                response.sendRedirect("Login.jsp?id_msj=1");
            }
        }catch(Exception e){
                response.sendRedirect("Login.jsp?id_msj=1");
        }
    }

    @Override
    public String getServletInfo() {
        return "Short description";
    }

}
